<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>文章表</title>
<t:base type="ckfinder,ckeditor,jquery,easyui,tools,DatePicker"></t:base>
<script type="text/javascript" src="plug-in/ckeditor_new/ckeditor.js"></script>
<script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
<script type="text/javascript">
  //编写自定义JS代码
  </script>

<script type="text/javascript">
var xmlHttp;
function createXmlhttp()
{
	xmlHttp=false;
	if(window.XMLHttpRequest)
	{
		xmlHttp=new XMLHttpRequest(); 
	}
	else if(window.ActiveXobject)
	{
		try{
		xmlHttp=new ActiveXobject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try{
			xmlHttp=new ActiveXobject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
			}
		}
		
	}
	if(!xmlHttp)
	{
		window.alert("can not create");
		return false;
	}
}
function query(getName)
{
	//alert("dsf");
	createXmlhttp();
	
	if(getName=="getArea")
	{
		
		xmlHttp.onreadystatechange=checked;
		xmlHttp.open("POST", "<%=request.getContextPath()%>/bnsArticleController.do?getAreaGroup&flag="+getName+"&id="+document.all.area.value);
	}
	
	else if(getName=="getGroup")
	{
		xmlHttp.onreadystatechange=checked2;
		xmlHttp.open("POST", "<%=request.getContextPath()%>/bnsArticleController.do?getAreaGroup&flag="+ getName + "&id=" + document.all.group.value);
		}

		xmlHttp.send(null);
	}
	function checked() {
		//alert(xmlHttp.readyState);
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {

				var xml = xmlHttp.responseXML;
				//alert(xml.toString());
				var value = xml.getElementsByTagName("element");
				while (document.all.group.options.length > 0) {
					document.all.group
							.removeChild(document.all.group.childNodes[0]);
				}
				for (i = 0; i < value.length + 1; i++) {
					var option = document.createElement("option");
					// 				option.value='请选择';
					// 				option.text='请选择';  
					option.value = value[i].childNodes[0].childNodes[0].nodeValue;
					option.text = value[i].childNodes[1].childNodes[0].nodeValue;
					document.all.group.options.add(option);
				}

			}
		}

	}
	function checked2() {
		//alert(xmlHttp.readyState);
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {

				var xml = xmlHttp.responseXML;
				//alert(xml.toString());
				var value = xml.getElementsByTagName("element");
				while (document.all.theme.options.length > 0) {
					document.all.theme
							.removeChild(document.all.theme.childNodes[0]);
				}
				for (i = 0; i < value.length; i++) {
					var option = document.createElement("option");
					option.value = value[i].childNodes[0].childNodes[0].nodeValue;
					option.text = value[i].childNodes[1].childNodes[0].nodeValue;
					document.all.theme.options.add(option);
				}

			}
		}

	}
</script>

</head>
<body>
	<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="bnsArticleController.do?doAdd" tiptype="1">
		<input id="id" name="id" type="hidden" value="${bnsArticlePage.id }">
		<input id="createName" name="createName" type="hidden" value="${bnsArticlePage.createName }">
		<input id="createDate" name="createDate" type="hidden" value="${bnsArticlePage.createDate }">
		<input id="commentsNum" name="commentsNum" type="hidden" value="${bnsArticlePage.commentsNum }">
		<input id="browseNum" name="browseNum" type="hidden" value="${bnsArticlePage.browseNum }">
		<table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
			<tr>
				<td align="right">
					<label class="Validform_label"> 标题: </label>
				</td>
				<td class="value">
					<input id="title" name="title" type="text" style="width: 150px" class="inputxt" datatype="s1-50">
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">标题</label>
				</td>
			<tr>
				<td align="right">
					<label class="Validform_label"> 内容: </label>
				</td>
				<td class="value">
					<t:ckeditor name="content" isfinder="true" value="" type="width:700"></t:ckeditor>
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">内容</label>
				</td>
			</tr>
			<tr>
				<td align="right">
					<label class="Validform_label"> 选择: </label>
				</td>
				<td class="value">
					<select name='area' onchange="query('getArea')">
						<option>请选择区域</option>
						<c:forEach items="${arealist}" var="pl">
							<option value="${pl.id}">${pl.areaName}</option>
						</c:forEach>
					</select>
	
					<select name='group' onchange="query('getGroup')">
						<option>请选择板块</option>
					</select>
	
					<select name='theme'>
						<option>请选择主题</option>
					</select>
				</td>
			<tr>
				<td align="right">
					<label class="Validform_label"> 文章标签: </label>
				</td>
				<td class="value">
					<t:dictSelect field="articleLabel" type="checkbox" typeGroupCode="artLab" defaultVal="${bnsArticlePage.articleLabel}" hasLabel="false"
						title="文章标签"></t:dictSelect>
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">文章标签</label>
				</td>
			</tr>
			<tr>
				<td align="right">
					<label class="Validform_label"> 发布状态: </label>
				</td>
				<td class="value">
					<t:dictSelect field="publisherStates" type="radio" typeGroupCode="pbsSta" defaultVal="${bnsArticlePage.publisherStates}" hasLabel="false"
						title="发布状态"></t:dictSelect>
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">发布状态</label>
				</td>
			<tr>
				<td align="right">
					<label class="Validform_label"> 置顶: </label>
				</td>
				<td class="value">
					<t:dictSelect field="isUp" type="list" typeGroupCode="sf_yn" defaultVal="${bnsArticlePage.isUp}" hasLabel="false" title="置顶"></t:dictSelect>
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">置顶</label>
				</td>
			</tr>

		</table>
	</t:formvalid>
</body>
<script type="text/javascript">
	function setTheme() {
		var gIds = document.getElementById("id").value;
		// 	 alert("-------------gIds:"+gIds);
	}
</script>
<script src="webpage/com/buss/article/bnsArticle.js"></script>